home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 003 / dbase.bas (.txt) < prev    next >
Encoding:
GW-BASIC  |  1985-07-13  |  1.8 KB  |  57 lines

  1. 10   '
  2. 15   '  Name     - DBase
  3. 20   '
  4. 25   '  Function - This program reads a DBase II file and lists the fields
  5. 30   '             on the screen.  This is a simple program, but it documents
  6. 35   '             the format of the header record of the data base.
  7. 40   '
  8. 45   '  Author   - Gerald F. Uhlig
  9. 50   '
  10. 55  CLS : CLOSE
  11. 60  DIM A$(5)
  12. 65  DIM C1$(32), C2$(32), C3(32), Z$(32)
  13. 70  INPUT "enter name of 'DBase' file "; F1$
  14. 75  F1$ = F1$ + ".dbf"
  15. 80  OPEN F1$ FOR INPUT AS 1
  16. 85  Q$ = INPUT$( 1,#1)
  17. 90  A$(1) = INPUT$( 2,#1)              ' Number of records
  18. 95  A$(2) = INPUT$( 1,#1)              ' Month - last update
  19. 100  A$(3) = INPUT$( 1,#1)              ' Day - last update
  20. 105  A$(4) = INPUT$( 1,#1)              ' Year - last update
  21. 110  A$(5) = INPUT$( 2,#1)              ' Length of record
  22. 115  A1 = (ASC(MID$(A$(1),1,1))) + (256 * (ASC(MID$(A$(1),2,1))))  ' Number of records
  23. 120  A5 = (ASC(MID$(A$(5),1,1))) + (256 * (ASC(MID$(A$(5),2,1)))) - 1  ' Length of data record
  24. 125  '
  25. 130  ' Set field descriptors
  26. 135  '
  27. 140  C0 = 0
  28. 145  FOR I = 1 TO 32
  29. 150  Q$ = INPUT$(16,#1)
  30. 155  IF ASC(MID$(Q$,1,1)) = 13 THEN I = 32 : GOTO 195    ' End of fields
  31. 160  C1$(I) = ""
  32. 165  FOR K = 1 TO 10
  33. 170  IF ASC(MID$(Q$,K,1)) <> 0 THEN C1$(I) = C1$(I) + MID$(Q$,K,1)
  34. 175  NEXT K
  35. 180  C2$(I) = MID$(Q$,12,1)
  36. 185  C3(I) =  VAL(MID$(Q$,13,1))
  37. 190  C0 = C0 + 1                        ' Number of fields
  38. 195  NEXT I
  39. 200  Q$ = INPUT$( 1,#1)                 ' Skip
  40. 205  '
  41. 210  ' Read data record
  42. 215  '
  43. 220  Y$ = INPUT$( 1,#1)                 ' Delete flag
  44. 225  FOR I = 1 TO C0
  45. 230  Z$(I) = INPUT$(C3(I),#1)           ' Read data field
  46. 235  NEXT I
  47. 240  '
  48. 245  ' List data record
  49. 250  '
  50. 255  CLS
  51. 260  FOR I = 1 TO C0
  52. 265  PRINT C1$(I); TAB(15); Z$(I)       ' Print data field
  53. 270  NEXT I
  54. 275  LOCATE 22,1 : INPUT "enter <Return> to continue ";H$
  55. 280  GOTO 205
  56. 285  END
  57.